package mapper;

import org.apache.ibatis.annotations.Param;
import pojo.entity.SysUser;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author 吴阳基
 * @datetime 2023/12/20 10:45
 */
public interface SysUserMapper {
    /**
     * 统计用户数量的方法
     * @return
     */
    int count();

     int add(SysUser sysUser);

    List<SysUser> getUserList();

    List<SysUser> getUserByRealName(String realName);

    List<SysUser> getUserListByPojo(SysUser sysUser);

    List<SysUser> getUserListByMap(Map<String, Object> userMap);

    List<SysUser> getUserListByParams(@Param("realName") String realName, @Param("roleId") int roleId);

    List<SysUser> getUserListWithRoleName(SysUser sysUser);

    List<SysUser> getUserListByRoleId(@Param("roleId") Integer roleId);

    List<SysUser> getUserAndAddressesByUserId(@Param("userId") Integer userId);



    int modify(SysUser sysUser);

    int updatePwd(@Param("id") Integer id, @Param("password") String pwd);

    /**
     * 删除用户的方法
     * @param id
     * @return
     */
    int deleteUserById(@Param("id") Integer id);

    /**
     * 用户列表的方法，根据用户名和角色id查询用户列表的方法(分页显示)
     * @param realName
     * @param roleId
     * @return
     */

    List<SysUser> selectList(@Param("realName") String realName, @Param("roleId") Integer roleId);

    List<SysUser> selectListByChoose(@Param("realName") String realName, @Param("roleId") Integer roleId, @Param("account") String account, @Param("createdTime") Date createdTime);

    List<SysUser> getUserByRoleIdArray(Integer[] roleIds);

    List<SysUser> getUserByRoleIdList(List<Integer> roleId);

    List<SysUser> getUserByRoleIdMap(Map<String, Object> map);

    int update(SysUser user);

    List<SysUser> selectPageList(@Param("realName") String realName,
                                 @Param("roleId") Integer roleId,
                                 @Param("pageBegin") Integer pageBegin,
                                 @Param("pageSize") Integer pageSize);

    public List<SysUser> selectSysUserList(SysUser sysUser);
}

